/*
 * usart.h
 *
 * Created: 05.09.2012 16:05:53
 *  Author: bardbakk
 */ 

/*!
 * @header		USART.h
 * @discussion	This file contains all declarations for usart communication
*/		

#ifndef USART_H_
#define USART_H_
#include <stdio.h>

/*!
 * @function	USART_init.
 * @discussion	Takes a baudrate and initialized USART0 with it,2 stop bits
				and 8 byte message length. Also enables the RX0 interrupt and links printf with USART_transmit().
 * @param		baudrate	The desired baudrate.
 * @result		None.
 */					
void USART_init(unsigned int baudrate);


/*!
 * @function	USART_transmit
 * @discussion	Waits for the usart to be ready then sends a byte over USART0.
 * @param		data	The byte to be sent.
 * @result		None.
 */		
void USART_transmit(unsigned char data);


/*!
 * @function	USART_receive
 * @discussion	Receives a byte from USART0 and sets the polling variable USART_msg_rcvd false.
 * @result		The received byte.
 */		
unsigned char USART_receive();


#endif /* USART_H_ */